package com.yhsoft.buyer.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yhsoft.buyer.controller.request.OrdersDyInVo;
import com.yhsoft.buyer.controller.request.VenderOrdersInVo;
import com.yhsoft.buyer.controller.response.OrdersDyOutVo;
import com.yhsoft.buyer.controller.response.VenderOrdersOutVo;
import com.yhsoft.buyer.service.IBuyerOrderService;
import com.yhsoft.common.response.PageResult;
import com.yhsoft.common.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author: yyyyyyyh
 * @create: 2023-11-20
 * @Version 1.0
 **/
@Api(tags = {"L-渠道商订单管理"})
@RestController
@RequestMapping("/salerOrders")
public class SalerOrderController {
    @Autowired
    private IBuyerOrderService iBuyerOrderService;

    @ApiOperation("订单管理")
    @GetMapping("/list")
    public Result<PageResult<VenderOrdersOutVo>> getOrderList(VenderOrdersInVo inVo,
                                                              @RequestParam(value = "pageNo") Long pageNo,
                                                              @RequestParam(value = "pageSize") Long pageSize) {
        IPage<VenderOrdersOutVo> iPage = iBuyerOrderService.getSalerOrderList(inVo, pageNo, pageSize);
        return Result.success(PageResult.valueOf(iPage));
    }


    @ApiOperation("订单管理(电影)")
    @GetMapping("/list_dy")
    public Result<PageResult<OrdersDyOutVo>> getOrderList_dy(OrdersDyInVo inVo,
                                                             @RequestParam(value = "pageNo") Long pageNo,
                                                             @RequestParam(value = "pageSize") Long pageSize) {
        IPage<OrdersDyOutVo> iPage = iBuyerOrderService.getSalerOrderList_dy(inVo, pageNo, pageSize);
        return Result.success(PageResult.valueOf(iPage));
    }

    @ApiOperation(("新增订单趋势"))
    @GetMapping("/get")
    public Result<List<Map<String, Object>>> get() {
        List<Map<String, Object>> map = iBuyerOrderService.getLine();
        return Result.success(map);
    }

}
